package acm.蓝桥16;

import java.util.Scanner;

public class B最大的数优化 {
    static int n, a, b;
    static byte[] num = new byte[20];  //左侧是低位，右侧是高位

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long t = sc.nextLong();
        a = sc.nextInt();
        b = sc.nextInt();
        while (t != 0) {
            num[n++] = (byte) (t % 10);
            t /= 10;
        }
        byte[] dfs = dfs(n - 1, a, b);
        for (int i = n - 1; i >= 0; i--) {
            System.out.print(dfs[i]);
        }
        System.out.println();
    }

    public static byte[] dfs(int i, int a, int b) {
        if (i < 0) {
            return num.clone();
        }
        byte cur = num[i];
        if (cur == 9) return dfs(i - 1, a, b);
        int upStep = Math.min(9 - cur, a); //上升到9
        byte[] up = dfs(i - 1, a - upStep, b);
        up[i] = (byte) (cur + upStep);
        int downStep = Math.min(cur + 1, b); //下降到9
        byte[] down = dfs(i - 1, a, b - downStep);
        down[i] = (byte) ((cur + 10 - downStep) % 10);
        if (max(i, up, down) == up) {
            return up;
        } else {
            return down;
        }
    }

    public static byte[] max(int i, byte[] a, byte[] b) {
        while (i >= 0 && a[i] == b[i]) {
            i--;
        }
        return i < 0 || a[i] > b[i] ? a : b;
    }
}
